package com.ag.lwc.action;

import java.util.List;

import com.ag.bean.TbUser;
import com.ag.lwc.service.FindfDepService;
import com.ag.zhh.vo.UserDept;
import com.ag.zhh.vo.UserDeptContact;

/**
 * 将药监局的第一层部门和一个部门的联系人查出来的action
 * @author user
 *
 */
public class FindfDeptAction extends com.ag.common.BaseAction {

	private List<UserDept> depts;
	private List<UserDeptContact> users;
	private String udid;	//部门id
	private String deptTypeId; //部门类型
	private FindfDepService service;
	
	/**
	 * 返回第一层的部门
	 * @return
	 */
	public String findFirstLevel()
	{
		try {
			udid="DI000000000";
			if("0000".equals(deptTypeId)) udid="DI000000000 ";
			else if("0001".equals(deptTypeId)) udid="CR0100000000";
			else if("0002".equals(deptTypeId)) udid="ES0100000000";
			else if("0003".equals(deptTypeId)) udid="EU0100000000";
			depts = service.findFirstLevel(udid);
			users = service.findDeptsUsers(udid);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "firstLeavel";
	}
	/**
	 * 返回下一层的部门和人
	 * @return
	 */
	public String nextLevel()
	{
		try {
			System.out.println("nextLevel 的udid： "+udid);
			depts = service.findNextLevel(udid);
			users = service.findDeptsUsers(udid);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "nextLeavel";
	}
	
	
	
	/**
	 * 查找部门的联系人的
	 * @return
	 */
	public String findPeoples()
	{
		try {
			users = service.findDeptsUsers(udid);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return "peoples";
	}
	public List<UserDept> getDepts() {
		return depts;
	}
	public void setDepts(List<UserDept> depts) {
		this.depts = depts;
	}
	public List<UserDeptContact> getUsers() {
		return users;
	}
	public void setUsers(List<UserDeptContact> users) {
		this.users = users;
	}
	public String getUdid() {
		return udid;
	}
	public void setUdid(String udid) {
		this.udid = udid;
	}
	public FindfDepService getService() {
		return service;
	}
	public void setService(FindfDepService service) {
		this.service = service;
	}
	public String getDeptTypeId() {
		return deptTypeId;
	}
	public void setDeptTypeId(String deptTypeId) {
		this.deptTypeId = deptTypeId;
	}
}
